return screen;
}
+void
+_gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
+ int scale)
+{
+ GList *toplevels, *l;
+
+ if (x11_screen->window_scale == scale)
+ return;
+
+ x11_screen->window_scale = scale;
+
+ toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen));
+
+ for (l = toplevels; l != NULL; l = l->next)
+ {
+ GdkWindow *window = l->data;
+
+ _gdk_x11_window_set_window_scale (window, scale);
+ }
+}
+
/*
* It is important that we first request the selection
* notification, and then setup the initial state of
{"Gtk/ShellShowsMenubar", "gtk-shell-shows-menubar"},
{"Gtk/EnablePrimaryPaste", "gtk-enable-primary-paste"},
{"Gtk/RecentFilesMaxAge", "gtk-recent-files-max-age"},
- {"Gtk/RecentFilesEnabled", "gtk-recent-files-enabled"}
+ {"Gtk/RecentFilesEnabled", "gtk-recent-files-enabled"},
+
+ /* These are here in order to be recognized, but are not sent to
+ gtk as they are handled internally by gdk: */
+ {"Gdk/WindowScalingFactor", "gdk-window-scaling-factor"}
};
static const char *
window->resize_count += 1;
}
}
-
- _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
}
static inline void
}
}
+static void
+set_scale_recursive (GdkWindow *window, int scale)
+{
+ GdkWindow *child;
+ GList *l;
+
+ for (l = window->children; l; l = l->next)
+ {
+ child = l->data;
+
+ if (child->impl != window->impl)
+ _gdk_x11_window_set_window_scale (child, scale);
+ else
+ set_scale_recursive (child, scale);
+ }
+}
+
+void
+_gdk_x11_window_set_window_scale (GdkWindow *window,
+ int scale)
+{
+ GdkWindowImplX11 *impl;
+ GdkToplevelX11 *toplevel;
+ GdkWindowHints geom_mask;
+
+ if (window->window_type == GDK_WINDOW_OFFSCREEN)
+ return;
+
+ impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
+ impl->window_scale = scale;
+
+ toplevel = _gdk_x11_window_get_toplevel (window);
+ if (toplevel && window->window_type != GDK_WINDOW_FOREIGN)
+ {
+ /* These are affected by window scale: */
+ geom_mask = toplevel->last_geometry_hints_mask &
+ (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC);
+ if (geom_mask)
+ gdk_window_set_geometry_hints (window,
+ &toplevel->last_geometry_hints,
+ geom_mask);
+ }
+
+ if (window->window_type == GDK_WINDOW_FOREIGN)
+ XMoveWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ (window->x + window->parent->abs_x) * impl->window_scale,
+ (window->y + window->parent->abs_y) * impl->window_scale);
+ else if (WINDOW_IS_TOPLEVEL(window))
+ XResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ window->width * impl->window_scale,
+ window->height * impl->window_scale);
+ else
+ XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ (window->x + window->parent->abs_x) * impl->window_scale,
+ (window->y + window->parent->abs_y) * impl->window_scale,
+ window->width * impl->window_scale,
+ window->height * impl->window_scale);
+
+ gdk_window_invalidate_rect (window, NULL, TRUE);
+
+ set_scale_recursive (window, scale);
+}
+
static gboolean
gdk_window_x11_reparent (GdkWindow *window,
GdkWindow *new_parent,
{
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
XSizeHints size_hints;
-
+ GdkToplevelX11 *toplevel;
+
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
+
+ toplevel = _gdk_x11_window_get_toplevel (window);
+ if (toplevel)
+ {
+ toplevel->last_geometry_hints = *geometry;
+ toplevel->last_geometry_hints_mask = geom_mask;
+ }
size_hints.flags = 0;
{
GdkEvent new_event;
+ if (!g_str_has_prefix (name, "gtk-"))
+ return;
+
new_event.type = GDK_SETTING;
new_event.setting.window = gdk_screen_get_root_window (GDK_SCREEN (x11_screen));
new_event.setting.send_event = FALSE;
int result;
GHashTable *old_list = x11_screen->xsettings;
+ GValue value = G_VALUE_INIT;
x11_screen->xsettings = NULL;
notify_changes (x11_screen, old_list);
if (old_list)
g_hash_table_unref (old_list);
+
+ g_value_init (&value, G_TYPE_INT);
+ if (gdk_screen_get_setting (GDK_SCREEN (x11_screen),
+ "gdk-window-scaling-factor", &value))
+ _gdk_x11_screen_set_window_scale (x11_screen,
+ g_value_get_int (&value));
}
static Atom